Skip to content

Conversation

@secondsun
Copy link
Contributor

Adding a snippet for Glance Inner Radius

@snippet-bot
Copy link

snippet-bot bot commented Mar 4, 2025

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

val resources = LocalContext.current.resources
// get dimension in float (without rounding).
val px = resources.getDimension(android.R.dimen.system_app_widget_background_radius)
val widgetBackgroundRadiusDpValue = px / resources.displayMetrics.density
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the helper function:

val widgetBackgroundRadiusDpValue =  with(LocalDensity.current){ intValue.toDp() }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalDensity isn't available during a glance composition. This is a glance snippet so the code would crash.

@secondsun secondsun force-pushed the glance_inner_radius branch from 6187d01 to dc43d2b Compare March 5, 2025 18:42
@secondsun secondsun merged commit bd170b9 into android:main Mar 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants